Skip to main content

Mask Aadhaar API

The following document highlights the details of the Mask Aadhaar API.

API Description

Objective

The Mask Aadhaar API hides the valid Aadhaar numbers and the associated QR (quick response) code in any document by blurring them for privacy and security reasons.

InputOutput
Images or files with the user's AadhaarThe masked Aadhaar document

API URL

https://ind-ckyc.hyperverge.co/api/v1/maskAadhaar

API Endpoint

maskAadhaar

Overview

The Mask Aadhaar API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format, and you should upload all images and files as form-data through a POST request.

Method - POST

Authentication

You need a unique pair of application ID (appId) and application key (appKey) from HyperVerge to verify your identity for accessing the Mask Aadhaar API.

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-typeMandatoryDefines the media type for the request payloadmultipart/form-data
appIdMandatoryThe application ID shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
appKeyMandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
transactionIdMandatoryA unique identifier for tracking a user journeyThis should be both unique and easily associated with the user's journey in your application(s)

Inputs

The following table provides the details of the parameters required for the Mask Aadhaar API's request body:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
fileMandatoryfileImages or files to be maskedMultipart file uploadNot Applicable
maskStandardAadhaarOnlyOptionalstringIf set to "yes", masks only the first 8 digits of the user's Aadhaar numberyes / nono
maskFullAadhaarOptionalstringIf set to "yes", masks all 12 digits of the user's Aadhaar numberyes / nono
maskQROptionalstringIf set to "yes", masks the QR code associated with the user's Aadhaaryes / noyes
returnMaskingInfoOptionalstringIf set to "yes", the API returns the maskingInfo.masked field with the details of the masking resultyes / nono
returnInputImageOptionalstringIf set to "yes", the API returns the input image as a URL that expires after 15 minutesyes / nono
maskAllAadhaarNumbersOptionalstringIf set to "yes", the API uses a more generic OCR to mask all Aadhaar numbers in the documentyes / nono
flagNonAadhaarCardsOptionalstringEnhances non-Aadhaar document classification. Works only when maskAllAadhaarNumbers is set to "yes"yes / nono
checkPreMaskedOptionalstring

If set to "yes", the API checks if the Aadhaar is already masked.

Note
Ensure that you enable the returnMaskingInfo parameter to retrieve the pre-masked information under the maskingInfo field of the response, if applicable.

yes / nono

Request

The following code snippets demonstrate standard curl requests for the Mask Aadhaar API:

curl --location --request POST 'https://ind-ckyc.hyperverge.co/api/v1/maskAadhaar' \
--header 'appId: <Enter_the_App_ID>' \
--header 'appKey: <Enter_the_App_Key>' \
--header 'transactionId: <Enter_the_Transaction_ID>' \
--form 'file=@"<Enter_the_File_Path>"'

Success Response

The following code snippet demonstrates a success response from the Mask Aadhaar API. It includes information about the document type, input file name, masked file name, occurrences of standard and non-standard Aadhaar numbers, masked file URL, total pages, and page-wise masked occurrences.

{
"status": "success",
"statusCode": "200",
"result": {
"docType": "<Doc_Type>",
"inputFile": "<Input_File_Name>",
"maskedFile": "<Masked_File_Name>",
"maskedOccurrences": {
"standardAadhaar": "<Standard_Aadhaar_Count>",
"nonStandardAadhaar": "<Non_Standard_Aadhaar_Count>"
},
"maskedFileUrl": "<Masked_File_URL>",
"totalPages": "<Total_Pages>",
"pageDetails": [
{
"page": "<Page_Number>",
"maskedOccurrences": {
"standardAadhaar": "<Standard_Aadhaar_Count>",
"nonStandardAadhaar": "<Non_Standard_Aadhaar_Count>"
}
}
]
}
}

Success Response Details

The following table outlines the details of the success response from the Mask Aadhaar API:

ParameterTypeDescription
docTypestring

The type of document detected. Possible values:

  • STANDARD_AADHAAR:Detected a basic or standard Aadhaar
  • NON_STANDARD_AADHAAR:Detected a non-standard or alternative format of Aadhaar
  • NOT_AADHAAR:Detected a document that is not an Aadhaar
  • NOT_SURE:The document type could not be identified
inputFilestringThe name of the input file submitted for masking
maskedFilestringThe name of the output masked file
maskedOccurrencesobjectThe count of standard and non-standard Aadhaar numbers masked in the document
maskedFileUrlstringThe URL of the masked file
totalPagesintegerThe total number of pages in the submitted document
pageDetailsarrayPage-wise breakdown of masking occurrences
maskingInfo.maskedstring

The masking result. Returned only when returnMaskingInfo is set to "yes". Possible values:

  • yes:The document was masked successfully
  • pre_masked:The document is already masked
  • not_sure:The masking was unsuccessful and the API failed to determine if the card was pre-masked

Error Responses

The following are some error responses from the Mask Aadhaar API:

{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_FILE_NOT_FOUND",
"message": "No file attached"
}
}

Error Response Details

A failure or error response contains a failure status with a relevant status code and error message. The following table lists the error responses for the Mask Aadhaar API:

Status CodeError MessageError DescriptionError Resolution
400No file attachedThe request is missing the file containing the user's AadhaarAttach the required file to the request
400pages exceeded the supported length of 5The API supports input files up to five pages in lengthReduce the document to 5 pages or fewer before submitting
401Missing/Invalid credentialsThe request is missing the mandatory appId and appKey combination or has invalid valuesVerify and provide valid credentials
413File too largeThe submitted file size exceeds the maximum allowed limitReduce the file size before submitting
500Internal Server ErrorKindly check the request headers or contact the HyperVerge team for resolutionCheck the request headers or contact the HyperVerge team for resolution
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: